package com.zito.health.controller;

import com.zito.health.common.annotations.ResponseResult;
import com.zito.health.entity.Area;
import com.zito.health.service.AreaService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @description:
 * @author: gxt
 * @time: 2019/11/8 14:40
 */
@Slf4j
@ResponseResult
@RestController
@RequestMapping("/area")
public class AreaController {

    @Autowired
    private AreaService areaService;

    @GetMapping
    public List<Area> list(Area area, Integer type){
        List<Area> list= areaService.query(area);
        if( type==null  ){//单位注册的地方需要有“委直属”，其他的不需要,单位注册时type==1，其他为null
            for(int i=0;i<list.size();i++){
                if(list.get(i).getAreaId()==370200){
                    list.remove(i);
                }
            }
        }
        return list;
    }
}
